package datatester;

import po.UserPO;
import userdata.Userdata;
import junit.framework.TestCase;

public class UserdataTester  extends TestCase{
	Userdata ud;
	
	public void testlogin(){

		try{
		ud = new Userdata();
		String result1 = ud.login("testS01","test","student");
		String result2 = ud.login("no id", "test", "student");
		String result3 = ud.login("testS02", "wrong password", "student");
		assertTrue(result1.equals("success")
				&&result2.equals("noUser")
				&&result3.equals("WrongPassword"));
		}catch(Exception e){
			assertTrue(false);
		}
	}

	public void testchangePassword(){
		UserPO test = new UserPO("testS01","test","student","SE");
		try{
			ud = new Userdata();
			ud.changePassword("testS01", "change", "student");
			assertTrue(test.getPassword().equals("change"));
		}catch(Exception e){
			assertTrue(false);
		}
	}
}
